home *** CD-ROM | disk | FTP | other *** search
/ Gekikoh Dennoh Club 2 / Gekikoh Dennoh Club Vol. 2 (Japan).7z / Gekikoh Dennoh Club Vol. 2 (Japan) (Track 01).bin / kowin / font / fonted31.lzh / OK.c < prev   
C/C++ Source or Header  |  1990-11-23  |  2KB  |  110 lines

  1. /*
  2.     Ko-Windowライブラリ  1990 by COR.
  3. */
  4.  
  5. #include    <stdio.h>
  6. #include    <wlib.h>
  7. #include    <parts.h>
  8.  
  9. static    char    *str;
  10.  
  11. static int    OKexec();
  12. static int    INPexec();
  13.  
  14. OK( msg )
  15. char    *msg;
  16. {
  17.     EventInfo    Info;
  18.     WindowID    wp;
  19.     ClipClass    yes,
  20.             no;
  21.  
  22.     str= msg;
  23.  
  24.     wp = WindowSimpleOpen( 234, 200, 300, 80, NULL, OKexec );
  25.     WindowRedraw( wp );
  26.  
  27.     ClipSet( &yes, 60-30, 50-4, 60, 24 );
  28.     ClipSet( &no, 240-30, 50-4, 60, 24 );
  29.  
  30.     for(;;){
  31.         WindowGetEventInfo( &Info );
  32.         if( Info.LeftStat && WindowGetChild( WindowRootID, &Info ) == wp ){
  33.             if( ClipInner( &yes, Info.x, Info.y ) ){
  34.                 WindowClose( wp );
  35.                 return    TRUE;
  36.             }else if ( ClipInner( &no, Info.x, Info.y ) ){
  37.                 WindowClose( wp );
  38.                 return    FALSE;
  39.             }
  40.         }
  41.     }
  42. }
  43.  
  44. static
  45. OKexec( wp, info )
  46. WindowID    wp;
  47. EventInfo    *info;
  48. {
  49.     DrawBuf        buf[10];
  50.  
  51.     switch( info->option ){
  52.         case EventRedraw:
  53.             DrawSetClear( buf, 1 );
  54.             DrawSetSymbol( buf+1, 30, 10, str, AttrDefault, 16 );
  55.             DrawSetSymbol( buf+2, 60-24, 50, "YES", AttrDefault, 16 );
  56.             DrawSetSymbol( buf+3, 240-16, 50, "NO", AttrDefault, 16 );
  57.             DrawSetLine( buf+4, 60-30, 50-4, 60+30, 50+20, ShadowDown, OptionShadow );
  58.             DrawSetLine( buf+5, 240-30, 50-4, 240+30, 50+20, ShadowDown, OptionShadow );
  59.             WindowDraw( wp, buf, 6 );
  60.             break;
  61.     }
  62.     return    TRUE;
  63. }
  64.  
  65. static    InputClass    input;
  66.  
  67. lineinput( ibuf )
  68. char    *ibuf;
  69. {
  70.     EventInfo    Info;
  71.     WindowID    wp;
  72.     int        i;
  73.  
  74.     InputSet( &input, 4, 4, ibuf, 37, 9, 16 );
  75.     wp = WindowSimpleOpen( 234, 200, 300, 22, NULL, INPexec );
  76.     WindowRedraw( wp );
  77.  
  78.     *ibuf= '\0';
  79.  
  80.     for(;;){
  81.         if( WindowGetEventInfo( &Info ) ){
  82.             DrawBuf    buf[10];
  83.             if( Info.KeyCode ){
  84.                 if( Info.KeyCode == 13 ){
  85.                     WindowClose( wp );
  86.                     return;
  87.                 }
  88.                 WindowDraw( wp, buf, InputKey(buf, &input, Info.KeyCode, Info.ShiftStat) );
  89.             }
  90.         }
  91.     }
  92. }
  93.  
  94. static
  95. INPexec( wp, info )
  96. WindowID    wp;
  97. EventInfo    *info;
  98. {
  99.     DrawBuf        buf[12];
  100.  
  101.     switch( info->option ){
  102.         case EventRedraw:
  103.             DrawSetClear( buf, 1 );
  104.             DrawSetLine( buf+1, 2, 2, 298, 20, ShadowDown, OptionShadow );
  105.             WindowDraw( wp, buf, 2+InputSetDraw( buf+2, &input ) );
  106.     }
  107.     return    TRUE;
  108. }
  109.  
  110.